<?php echo $this -> Html -> css('Base/index'); ?>
<?php echo $this->element('assets/datetimepicker'); ?>
<!-- BEGIN PAGE CONTENT-->
<!-- general form elements -->
<div class="box box-primary">
    <div class="box-header">
        <h3 class="box-title">Products Add</h3>
    </div><!-- /.box-header -->
    <!--error -->
    <?php
    	if(isset($errors)){
    		echo $this->element('errors', array('errors' => $errors)); 
		}
    ?>
    <?php echo $this->Session->flash();?>
    <!-- form start -->
    <form role="form" action="/admin/products/add" method="post" class="addProducts" enctype="multipart/form-data">
        <div class="box-body">
            <?php echo $this -> Form -> input('name', array(
                'div' => 'form-group',
                'label' => 'Tên App',
                'class' => 'form-control',
                'placeholder' => 'Nhập App',     
                'maxlength'=>100,    
            ));?>
            <!-- Input -->
            <?php echo $this -> Form -> input('youtubeId', array(
                'div' => 'form-group',
                'label' => 'youtube Id',
                'class' => 'form-control',
                'placeholder' => 'Nhập youtube Id',     
                'maxlength'=>100,    
            ));?>
            
            <!-- Input -->
            <?php echo $this -> Form -> input('linkApp', array(
                'div' => 'form-group',
                'label' => 'link app',
                'class' => 'form-control',
                'placeholder' => 'link app',     
                'maxlength'=>100,    
            ));?>
            <div class="form-group">
	        	<label class="control-label">Hệ điều hành</label><br>
	        	<select name="data[osId]" class="form-control">
	        		<?php foreach($os as $item){?>
	        			<option value="<?php echo $item['Os']['id']?>" ?><?php echo $item['Os']['name']?></option>
	        		<?php } ?>
	        	</select>
	        </div>
            <!-- CK Editor -->
            <div class="form-group">
                <label>Mô tả ngắn (Tổng quan)</label>
                <textarea id="editor1" name="data[details]" rows="10" cols="80">
                    This is my textarea to be replaced with CKEditor.
                </textarea>  
            </div>           
            <div class="form-group">
            	<label>Hình đại diện của app (300 x 300)</label>
            	<input type="file" name="data[img1]"/>
            </div>
            <div class="form-group">
            	<label>Hình đại diện của app (300 x 300)</label>
            	<input type="file" name="data[img2]"/>
            </div>
            <div class="form-group">
            	<label>icon của app (145 x 145)</label>
            	<input type="file" name="data[icon]"/>
            </div>
        </div><!-- /.box-body -->

        <div class="box-footer">
            <button type="submit" class="btn btn-primary">Submit</button>
        </div>
    </form>
</div><!-- /.box -->
<!-- END PAGE CONTENT-->

<!-- page script -->
<script type="text/javascript">
	$(function() {
		// Replace the <textarea id="editor1"> with a CKEditor
		// instance, using default configuration.
		var basePath = "<?php echo Router::url('/'); ?>";
		CKEDITOR.replace('editor1',{
		filebrowserBrowseUrl : basePath + 'js/kcfinder/browse.php?type=files',
		filebrowserImageBrowseUrl : basePath + 'js/kcfinder/browse.php?type=images',
		filebrowserFlashBrowseUrl : basePath + 'js/kcfinder/browse.php?type=flash',
		filebrowserUploadUrl : basePath + 'js/kcfinder/upload.php?type=files',
		filebrowserImageUploadUrl : basePath + 'js/kcfinder/upload.php?type=images',
		filebrowserFlashUploadUrl : basePath + 'js/kcfinder/upload.php?type=flash'
	});
        CKEDITOR.replace('editor2',{
		filebrowserBrowseUrl : basePath + 'js/kcfinder/browse.php?type=files',
		filebrowserImageBrowseUrl : basePath + 'js/kcfinder/browse.php?type=images',
		filebrowserFlashBrowseUrl : basePath + 'js/kcfinder/browse.php?type=flash',
		filebrowserUploadUrl : basePath + 'js/kcfinder/upload.php?type=files',
		filebrowserImageUploadUrl : basePath + 'js/kcfinder/upload.php?type=images',
		filebrowserFlashUploadUrl : basePath + 'js/kcfinder/upload.php?type=flash'
	});
		//bootstrap WYSIHTML5 - text editor
		$(".textarea").wysihtml5();
	});
</script>